#include "VictoryState.h"
#include "stdafx.h"
/**************************************************************/
// GetInstance
//	- store the ONLY instance in global memory
//	- return the only instance by pointer
/*static*/ VictoryState* VictoryState::GetInstance(void)
{
	static VictoryState s_Instance;

	return &s_Instance;
}


/**************************************************************/
// Enter
//	- reset the game & load resources
void VictoryState::Enter(void)
{

	// Set background color
	SGD::GraphicsManager::GetInstance()->SetClearColor({ 50, 50, 50 });	// dark gray
	offset = 0;
}

/**************************************************************/
// Exit
//	- deallocate / unload resources
/*virtual*/ void VictoryState::Exit(void)
{

}

/**************************************************************/
// Input
//	- Handles User Input
bool VictoryState::Input()
{
	SGD::InputManager* pInput = SGD::InputManager::GetInstance();

	if (pInput->IsKeyPressed(SGD::Key::Escape) == true ||
		SGD::InputManager::GetInstance()->IsButtonPressed(0, 1) == true)
	{
		offset = 0.0f;
		Game::GetInstance()->ChangeState(MainMenuState::GetInstance());
	}


	return true;
}
/**************************************************************/
// Update
//	- update Objects / animations
void VictoryState::Update(float elapsedTime)
{
	if (offset >= 2200)
	{
		offset = 0.0f;
		Game::GetInstance()->ChangeState(MainMenuState::GetInstance());
	}
	offset += elapsedTime * 50;
}
/**************************************************************/
// Render
//	- Render Objects / animations
void VictoryState::Render()
{
	// Use the game's font
	BitmapFont* pFont = Game::GetInstance()->GetFont();

	// Align text based on window width
	int width = (int)Game::GetInstance()->GetScreenWidth();

	//create a string for the credits
	string credits = "";
	//add the EP
	credits += "EP:\n\nJohn OLeske\n\n\n";

	//add the AP(s)
	credits += "AP:\n\nRobert Martinez\n\n\n";

	//add the Artists
	credits += "Artists:\n\nGregory Bey\nCaris Frazier\n\n";

	//add the developers
	credits += "Developers:\n\nWilliam Kennedy\nJoseph Reichel\nGeorge Scott\nZachary Shields\nDavid Stout\n\n\n";

	//QA
	credits += "Quality Assurance\n\nAlex Brown\nWilliam Kennedy\nEthan Mills\nMichael Mozdzierz\nDeShon Thomas-Wright\n\n\n";

	//special thanks
	credits += "Special Thanks to\n\nSean Hathaway\nShawn Paris\n\n\n";

	//thank you for playing
	credits += "\n\n\n\nTHANK YOU FOR PLAYING!";

	// Display the game title centered at 4x scale
	pFont->Draw("Victory", 250, int(300 - offset), 2.0f, {});

	pFont->Draw("MEGALANDS", 100, int(700 - offset), 2.0f, {});

	pFont->Draw("Odd Giant Studio\n\nS3", 250, int(900 - offset), 1.0f, {});

	pFont->Draw(credits.c_str(), 250, int(1200 - offset), .7f, {});

	//pFont->Draw("ESC (B) to return to Main Menu", 25, 500, .7, {});
}